Skip to content

fix(cli): resolve http.server via getServiceAsync in console/runtime-assets plugins#2855

Merged
os-zhuang merged 1 commit into
mainfrom
claude/fix-console-http-server-async
Jul 12, 2026
Merged

fix(cli): resolve http.server via getServiceAsync in console/runtime-assets plugins#2855
os-zhuang merged 1 commit into
mainfrom
claude/fix-console-http-server-async

Conversation

@os-zhuang

Copy link
Copy Markdown
Contributor

Problem

The com.objectstack.runtime-assets and com.objectstack.console-static plugins (packages/cli/src/utils/console.ts) fetch the http.server service with the synchronous ctx.getService('http.server').

When http.server is registered as an async factory — the console / schema-migration boot path — getService throws Service 'http.server' is async - use await. Because the call sat outside any try/catch, the throw escaped the plugin's start() and rolled back kernel bootstrap:

ERROR Plugin startup failed: com.objectstack.runtime-assets
  Service 'http.server' is async - use await
    at Object.getService (packages/core/dist/index.js:1355)
    at Object.start (packages/cli/src/utils/console.ts:471)

This crashed the cloud control-plane schema-migration boot (the deploy's "Schema migration — production DB" step). The runtime serve path, where Runtime registers http.server synchronously, was unaffected — so only the console/migration boot path broke.

Fix

Resolve http.server through a shared resolveHttpServer() helper that prefers the async accessor (getServiceAsync, which resolves a sync- or async-registered service) and falls back to the sync accessor — mirroring plugin-auth's async cache lookup. The helper never throws, so these optional static-asset plugins skip cleanly when no HTTP server is present instead of aborting boot.

These two are the only hard-crash consumers of http.server: every other consumer (serve.ts unknown-hostname-guard, metadata, rest, dispatcher) already wraps the sync getService in try/catch and degrades gracefully.

Base / scope

Branched from cb662a5f (the commit cloud currently pins) so the change is exactly cb662a5f + this fix — minimal drift, keeping the objectos-prod image byte-identical apart from this boot-safety fix. console.ts is byte-identical at cb662a5f and main, so it applies cleanly to main too.

Merge with a merge commit (not squash) so the cloud-pinned commit decd1746 stays reachable in main history, matching the cb662a5f precedent.

Test plan

  • framework CI (typecheck + tests) green
  • cloud re-pins .framework-shadecd1746; cloud build-and-test builds framework@decd1746 + boot-smoke green
  • cloud-staging deploy boots the console/migration path cleanly (no runtime-assets crash)
  • deploy-cloud-prod "Schema migration" step boots the kernel cleanly + "Deploy PRODUCTION" runs

Generated by Claude Code

…assets plugins

The console-static + runtime-assets plugins fetched `http.server` with the
synchronous `ctx.getService('http.server')`. When that service is registered
as an async factory (the console / schema-migration boot path) the sync
accessor throws `Service 'http.server' is async - use await`; sitting outside
any try/catch, the throw escaped the plugin's start() and rolled back kernel
bootstrap, crashing the CONSOLE/migration boot (com.objectstack.runtime-assets
failed to start). The runtime serve path, where http.server is registered
synchronously, was unaffected — which is why only the control-plane migration
boot broke.

Resolve http.server through a shared resolveHttpServer() helper that prefers
getServiceAsync (which resolves a sync- or async-registered service) and falls
back to the sync accessor, mirroring plugin-auth's async cache lookup. The
helper never throws, so these optional static-asset plugins skip cleanly when
no HTTP server is present instead of taking down boot.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsVkwjvWDBRiYb1HNGfcXr
@vercel

vercel Bot commented Jul 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
spec Ready Ready Preview, Comment Jul 12, 2026 12:56pm

Request Review

@github-actions github-actions Bot added documentation Improvements or additions to documentation tooling size/s labels Jul 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/cli.

14 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:

  • content/docs/ai/skills-reference.mdx (via packages/cli)
  • content/docs/api/client-sdk.mdx (via @objectstack/cli)
  • content/docs/api/data-flow.mdx (via @objectstack/cli)
  • content/docs/api/environment-routing.mdx (via @objectstack/cli)
  • content/docs/api/error-catalog.mdx (via @objectstack/cli)
  • content/docs/automation/hook-bodies.mdx (via packages/cli)
  • content/docs/getting-started/cli.mdx (via @objectstack/cli)
  • content/docs/kernel/runtime-services/data-service.mdx (via packages/cli)
  • content/docs/kernel/runtime-services/index.mdx (via packages/cli)
  • content/docs/permissions/authentication.mdx (via @objectstack/cli)
  • content/docs/plugins/packages.mdx (via @objectstack/cli)
  • content/docs/protocol/objectos/plugin-spec.mdx (via @objectstack/cli)
  • content/docs/protocol/objectos/realtime-protocol.mdx (via @objectstack/cli)
  • content/docs/releases/implementation-status.mdx (via @objectstack/cli)

Advisory only. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs origin/main → pass the list as args.docs.

@os-zhuang os-zhuang marked this pull request as ready for review July 12, 2026 13:01
@os-zhuang os-zhuang merged commit a6db6e2 into main Jul 12, 2026
16 checks passed
@os-zhuang os-zhuang deleted the claude/fix-console-http-server-async branch July 12, 2026 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/s tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants